package com.singfan.core.component;

import com.singfan.core.dao.database.model.BarberToken;

/**
 * Author: HanSongHe
 * Date: 2015-09-03 15:50
 * Desc:
 */
public class BarberTokenHolder {
    private static final ThreadLocal<BarberToken> barberTokenLocal = new ThreadLocal<BarberToken>();

    public static void bindBarberToken(BarberToken barberToken){
        if(barberToken == null){
            barberTokenLocal.remove();
        }
        else{
            barberTokenLocal.set(barberToken);
        }
    }

    public static BarberToken getCurrentBarberToken(){
        return barberTokenLocal.get();
    }

    public static void unbindBarberToken(){
        barberTokenLocal.remove();
    }
}
